package com.abe.libquick.utils;

import android.content.Context;
import android.content.DialogInterface;

import com.abe.libquick.R;
import com.abe.libquick.widget.dialog.CustomDialog;

public class DialogHelper {
    public static void normal(Context context, int titleStrRes, int msgStrRes,
                              DialogInterface.OnClickListener pListener) {
        normal(context, R.drawable.dialog_shape, titleStrRes, msgStrRes, pListener);
    }

    public static void normal(Context context, int contentBg, int titleStrRes, int msgStrRes,
                              DialogInterface.OnClickListener pListener) {
        String titleStr = context.getResources().getString(titleStrRes);
        String msgStr = context.getResources().getString(msgStrRes);
        normal(context, contentBg, titleStr, msgStr, pListener);
    }

    public static void normal(Context context, String titleStr, String msgStr,
                              DialogInterface.OnClickListener pListener) {
        normal(context, R.drawable.dialog_shape, titleStr, msgStr, pListener);
    }

    public static void normal(Context context, int contentBg, String titleStr, String msgStr,
                              DialogInterface.OnClickListener pListener) {
        normalBuilder(context, contentBg, titleStr, msgStr, pListener).create().show();
    }

    public static CustomDialog.Builder normalBuilder(Context context, int contentBg, String titleStr, String msgStr,
                                                     DialogInterface.OnClickListener pListener) {
        return new CustomDialog.Builder(context)
                .setContentBG(contentBg)
                .setTitle(titleStr)
                .setIcon(android.R.drawable.ic_dialog_info)
                .setMessage(msgStr)
                .setPositiveButton(R.string.commit, pListener);
    }

    public static void normalCC(Context context, int titleStrRes, int msgStrRes,
                                DialogInterface.OnClickListener pListener,
                                DialogInterface.OnClickListener nListener) {
        normalCC(context, R.drawable.dialog_shape, titleStrRes, msgStrRes, pListener, nListener);
    }

    public static void normalCC(Context context, String titleStr, String msgStr,
                                DialogInterface.OnClickListener pListener,
                                DialogInterface.OnClickListener nListener) {
        normalCC(context, R.drawable.dialog_shape, titleStr, msgStr, pListener, nListener);
    }

    public static void normalCC(Context context, int contentBg, int titleStrRes, int msgStrRes,
                                DialogInterface.OnClickListener pListener,
                                DialogInterface.OnClickListener nListener) {
        String titleStr = context.getResources().getString(titleStrRes);
        String msgStr = context.getResources().getString(msgStrRes);
        normalCC(context, contentBg, titleStr, msgStr, pListener, nListener);
    }

    public static void normalCC(Context context, int contentBg, String titleStr, String msgStr,
                                DialogInterface.OnClickListener pListener,
                                DialogInterface.OnClickListener nListener) {
        normalCCBuilder(context, contentBg, titleStr, msgStr, pListener, nListener).create().show();
    }

    public static CustomDialog.Builder normalCCBuilder(Context context, int contentBg, String titleStr, String msgStr,
                                                       DialogInterface.OnClickListener pListener,
                                                       DialogInterface.OnClickListener nListener) {
        return new CustomDialog.Builder(context)
                .setContentBG(contentBg)
                .setTitle(titleStr)
                .setIcon(android.R.drawable.ic_dialog_info)
                .setMessage(msgStr)
                .setNegativeButton(R.string.cancel, nListener)
                .setPositiveButton(R.string.commit, pListener);
    }
}